// 统一请求路径前缀在libs/axios.js中修改
import {
  getRequest,
  postRequest,
  deleteRequest,
  managerUrl
} from "@/libs/axios";
const manager = BASE.API_DEV.manager;

// 获取专栏列表
export const getColumnPage = () => {
  return getRequest("/course/category/getCategory");
}

// 新增、编辑栏目
export const postColumn = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest("/course/category/saveOrUpdateCategory", params, headers);
}

// 删除栏目
export const delColumn = (id) => {
  return deleteRequest(`/course/category/${id}`);
};

// 获取筛选条件-课程类型列表
export const getColumnType = () => {
  return getRequest("/course/category/getCategory");
}

// 获取课程审核列表
export const postColumnPage = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(managerUrl + "/course/courseReviewed/pagelist", params, headers);
}

// 批量课程审核
export const postDealBat = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(managerUrl + "/course/courseReviewed/dealBat", params, headers);
}

// 置顶
export const postCourseTop = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(managerUrl + "/course/courseSeries/setCoursePageTop", params, headers);
}

// 取消置顶
export const postCancelCourseTop = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(managerUrl + "/course/courseSeries/cancelCoursePageTop", params, headers);
}

// 根据ID获取课程列表
export const getCourseById = (id) => {
  return getRequest(`${managerUrl}/course/course/getCourseByCourseSeriesId/${id}`);
}

// 根据ID获取课程信息
export const getCourseInfoById = (id) => {
  return getRequest(`${managerUrl}/course/courseSeries/${id}`);
}

// 获取课程分页列表
export const postCoursePage = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(managerUrl + "/course/courseSeries/byPage", params, headers);
}

// 获取专家分页列表
export const postExpertPage = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(managerUrl + "/expert/expert/list_", params, headers);
}

// 获取课程评论
export function getCourseInfo(id) {
  return getRequest(`${manager}/courseSeriesBaseEvaluate/getEvaluateCount/${id}`);
}

// 课程评论分页数据
export function getCourseContPage(params) {
  let headers = { "Content-Type": "application/json"}
  return postRequest(`${manager}/courseSeriesBaseEvaluate/listByPage`, params, headers);
}